/**
 * @Date 2025/1/2 8:57
 * @Created by 衡盛永
 */

package org.example.deploy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.deploy.mapper.SysUserMapper;
import org.example.deploy.pojo.SysUser;
import org.example.deploy.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
    // 继承了 BaseService 和 ServiceImpl 的所有方法
    // 这里可以编写业务逻辑代码
    @Autowired
    private SysUserMapper userMapper;

    @Override
    public List<SysUser> getUsersXml() {
        return userMapper.getUsersXml();
    }

    @Override
    public SysUser getUserByUserName(String username) {
        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", username);
        return userMapper.selectOne(queryWrapper);
    }

    @Override
    public Integer getRoleIdByUserId(Integer userId) {
        return userMapper.getRoleIdByUserId(userId);
    }
}